﻿// Decompiled with JetBrains decompiler
// Type: SP1.Effects
// Assembly: SP1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 4A78F1E7-7FD5-407C-8917-5F99ECC43C34
// Assembly location: C:\Users\KasimGulcan\Desktop\Project\DynaCAD\bin\Debug\SP1.dll

using System.Windows.Media.Effects;
using System.Xml;

namespace SP1
{
  public static class Effects
  {
    public static DefinitionElement.FilterElement Effect(XmlNode xn)
    {
      DefinitionElement.FilterElement filterElement = new DefinitionElement.FilterElement();
      BlurEffect blurEffect = new BlurEffect();
      string str = "void";
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) xn.Attributes)
      {
        if (xmlAttribute.Name == "id")
          str = xmlAttribute.Value;
      }
      if (xn.HasChildNodes)
      {
        foreach (XmlNode xmlNode in xn.ChildNodes)
        {
          if (xmlNode.Name == "feGaussianBlur")
          {
            foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) xmlNode.Attributes)
            {
              if (xmlAttribute.Value != "none")
              {
                switch (xmlAttribute.Name)
                {
                  case "stdDeviation":
                    blurEffect.Radius = 3.0 * AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
                    continue;
                  default:
                    continue;
                }
              }
            }
          }
        }
      }
      filterElement.Name = str;
      filterElement.E = (Effect) blurEffect;
      DefinitionElement.FEL.Add(filterElement);
      return filterElement;
    }
  }
}
